import { request } from '@/utils/request';

/**
 * @description 获取table列表
 */
export function getTableListApi(data?: API.SearchParams) {
  return request({
    url: '/manage/admin/user/pageList',
    method: 'post',
    data,
  });
}

/**
 * @description 用户启用禁用
 */
//
export function updateStatusApi(data?: API.StatusParams) {
  return request(
    {
      url: '/manage/admin/user/updateStatus',
      method: 'put',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * @description 编辑用户
 */
//
export function updateUser(data: API.UpdateUserParams) {
  return request({
    url: '/manage/admin/user/updateUser',
    method: 'put',
    data,
  });
}

/**
 * @description 新增用户
 */
//
export function createUser(data: API.CreateUserParams) {
  return request({
    url: '/manage/admin/user/addUser',
    method: 'post',
    data,
  });
}

/**
 * @description 获取用户详情
 */
//
export function getDetailUser(userId: string) {
  return request({
    url: `/manage/admin/user/userDetail/${userId}`,
    method: 'get',
  });
}

/**
 * @description 获取机构列表全部
 */
//
export function getDeptList() {
  return request({
    url: `/manage/admin/dept/deptList`,
    method: 'post',
  });
}

/**
 * @description 根据结构id获取角色列表
 */
//
export function getRoleList(deptTypeId?: string) {
  return request({
    url: `/manage/admin/role/roleList/${deptTypeId}`,
    method: 'get',
  });
}

/**
 * @description 删除用户
 */
//
export function deleteUserApi(userId?: string) {
  return request({
    url: `/manage/admin/user/delete/${userId}`,
    method: 'delete',
  });
}

/**
 * @description 重置密码
 */
//
export function resetPwdApi(data) {
  return request({
    url: `/manage/admin/user/resetPwd`,
    method: 'put',
    data,
  });
}

//
